package com.mql.gre.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Vector;

import org.w3c.dom.stylesheets.DocumentStyle;

import com.mql.gre.beans.Document;
import com.mql.gre.business.Criterias;

public class XMLDAO implements DAO {

	private DocParser docParser;
	private ClusterParser clusterParser;

	// FOR RESTfull Test
	Vector<Document> ds;
	private HashMap<String, Object> data;

	public XMLDAO() {
		ds = new Vector<Document>();
		data = new HashMap<String, Object>();
		data.put("title", "RS WebServise");
		data.put("author", "WhoKnows");
		ds.add(new Document("001", data));
		data = new HashMap<String, Object>();
		data.put("title", "JAX-RS");
		data.put("author", "WhoKnowsAgain");
		ds.add(new Document("002", data));

		// TODO Auto-generated constructor stub
	}

	public XMLDAO(DocParser docParser, ClusterParser clusterParser) {
		super();
		this.docParser = docParser;
		this.clusterParser = clusterParser;
	}

	public void insert(Document document) {
		ds.add(document);

	}

	public void remove(Document document) {
		ds.remove(document);
	}

	public void update(Document document) {

	}

	public Document select(String id) {

		for (Document doc : ds) {
			if (doc.getId().equals(id))
				return doc;
		}
		return null;
	}

	public List<Document> select(Criterias criterias) {

		return null;
	}

	public void remove(String id) {
		// TODO Auto-generated method stub

	}

}
